; ARM code Christmas tree by S.Harrison (steve3000)
; 13 instructions. Each ARM instruction = 4 bytes. Total = 52 bytes code.

.start
ADR   R1,dataend   ;point R1 to end of data
.mainloop
LDRB  R2,[R1,#-1]! ;load a byte of data to R2, and decrement R1
MOV   R3,R2,LSR#1  ;R3 = R2 DIV 2
RSBS  R3,R3,#30    ;calc no. of spaces to centre desktop textbox, set flags
MOVLE PC,R14       ;...this wll exit if the pulled byte is >=30
.spaceloop
SWI   256+32       ;output a space
SUBS  R3,R3,#1
BGT   spaceloop    ;loop until all spaces complete
.starloop
SWI   256+42       ;output a star
SUBS  R2,R2,#1
BGT   starloop     ;loop until all stars complete
SWI   "OS_NewLine" ;next line
B     mainloop     ;first byte of this inst. will be &FC, to trigger exit

.data   ;Data table for 14 rows. Total = 14 bytes data.
EQUB 3 :EQUB 3:EQUB 23:EQUB 17:EQUB 11:EQUB 5 :EQUB 15
EQUB 11:EQUB 7:EQUB 3 :EQUB 7 :EQUB 5 :EQUB 3 :EQUB 1
.dataend
.end

;Total output size = 52 + 14 = 66 bytes